<h1><%= "#{t(:listing)} #{t(:diagnoses)}" %></h1>

<table>
  <thead>
    <tr>
      <th><%= t :patient_name %></th>
      <th>Label</th>
      <th><%= t :diagnosis_group %></th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @diagnoses.each do |diagnosis| %>
      <tr>
        <td><%= diagnosis.appointments.map {|a| a.patient.full_name}.join(', ') %></td>
        <td><%= diagnosis.label %></td>
        <td><%= diagnosis.diagnosis_group.label %></td>
        <td><%= link_to "#{t(:show)}", diagnosis %></td>
        <td><%= link_to "#{t(:edit)}", edit_diagnosis_path(diagnosis) %></td>
        <td><%= link_to "#{t(:destroy)}", diagnosis, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to "#{t(:new_diagnosis)}", new_diagnosis_path %>
